package map;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

public class Test {
    public static void main(String[] args) {
        String line="i love java!thinking in java !! hello World";
        for (int i = 0; i <line.length() ; i++) {
           char index= line.charAt(i);
           System.out.println(index);
        }
        Map<String ,Integer> map=new LinkedHashMap<>();
        //key统计出现的字符
        for (int i = 0; i <line.length() ; i++){
            char index= line.charAt(i);
            if (map.containsKey(String.valueOf(index))){
                int count=map.get(String.valueOf(index));
                map.put(String.valueOf(index),count+1);
            }else {
                map.put(String.valueOf(index),1);
            }

        }
        System.out.println(map);

    }
}
